import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import request from './utils/request'
import store from './store'

// 引入jQuery
import $ from 'jquery'
window.$ = $

// 引入Element Plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 引入Element Plus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 引入中文语言包
import zhCn from "element-plus/dist/locale/zh-cn.mjs"

// 引入ECharts
import * as echarts from 'echarts'

const app = createApp(App)

// 全局挂载axios实例
app.config.globalProperties.$http = request
// 全局挂载echarts
app.config.globalProperties.$echarts = echarts
// 全局挂载jQuery
app.config.globalProperties.$jquery = $

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 使用插件
app.use(router)
app.use(store)
app.use(ElementPlus, {
  locale: zhCn
})

app.mount('#app')
